package com.arsn.myf.resource.service.impl;

import com.arsn.myf.resource.entity.Oss;
import com.arsn.myf.resource.mapper.OssMapper;
import com.arsn.myf.resource.service.OssService;
import com.arsn.myf.resource.vo.OssVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * 存储对象服务实现层
 * @author zhongrj
 * @since 2021-12-07
 */
@Service
public class OssServiceImpl extends ServiceImpl<OssMapper, Oss> implements OssService {

    /**
     * 自定义存储对象分页数据
     * @param page
     * @param oss
     * @return
     */
    @Override
    public IPage<OssVO> selectPageOssList(Page<OssVO> page, OssVO oss) {
        return baseMapper.selectPageOssList(page, oss);
    }

    /**
     * 查询默认的oss配置源
     * @return
     */
    @Override
    public Oss getDefaultOssInfo() {
        QueryWrapper<Oss> ossQueryWrapper = new QueryWrapper<Oss>();
        ossQueryWrapper.eq("status",1);
        //返回
        return baseMapper.selectOne(ossQueryWrapper);
    }
}
